﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FunctionPoint.UIManagers;
using Microsoft.VisualStudio.Text.Editor;
using System.Runtime.InteropServices;
using FunctionPoint.Common;
using Microsoft.VisualStudio.TeamFoundation;
using Microsoft.VisualStudio.Shell;
using FunctionPoint.Adornments;
using System.Collections.ObjectModel;

namespace FunctionPoint.Services
{
    [Guid("6FC32C18-8F4A-49B0-B2A4-DDE38021B4C8")]
    public interface IFunctionPointManagerService : SFunctionPointManagerService
    {

        //WpfTextViewAdornmentManager GetOrCreateManagerForTextView(IWpfTextView textView);
        //WpfTextViewAdornmentManager GetOrCreateManagerForTextView();

        void AddWorkItemToDisplay(WorkItem workItem, bool includeChildren);
        void AddWorkItemToDisplay(WorkItem workItem);

        void RemoveWorkItemToDisplay(WorkItem workItem, bool includeChildren);
        void RemoveWorkItemToDisplay(WorkItem workItem);

        ObservableWorkItemCollection GetWorkItemsAssociatedToView(IWpfTextView textView);
        ObservableWorkItemCollection GetWorkItemsAssociatedToView();
        ObservableWorkItemCollection GetWorkItemsForDisplay();

        void RegisterProjectChangedSubscriber(IFunctionPointManagerServiceSubscriber subscriber);
        ObservableCollection<Common.WorkItemQueryFolder> GetAllQueriesAndOptionallyWorkItems(string projectName, bool includeWorkItems = false, bool flattenHierarchy = false);
         Common.ObservableFlattenedQueryHierarchy GetFlattenedQueryHierarchy(string projectName, bool includeWorkItems = false);

        List<TfsUser> GetUsersByGroupName(string groupName);
        List<TfsUserGroup> GetUserGroups();
        TfsUser GetCurrentUser();
        

        void GetQueryWorkItems(Common.WorkItemQuery queryItem);

        Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem CreateDesignPointWorkItem(string designPointTitle, string designComments, string designerName, int parentWorkItemId, string itemPath, int changeSet,
           int lineNumber, int closestCharacterPosition);

        string GetServerPath(string localPath);
        int GetLatestChangeSetId(string localPath);
        
    }

    /* 
     * Shim - has to do with memory consumption in Visual Studio, Google: How to provide a service VS2010 SDK.  Pretty cool actually
     * The S version provides nothing but the I version actually does the implementation.  However it implements the SFunctionPointManagerService
     * in the end, when you register or request the SFunctionPointManagerService you will always get the IFunctionPoint (because it's the actual interface).
     * 
     * So seriously?  Why?  
     * 
     * 1.  If you notice you have  of simliar interfaces in Visual Studio as the years have gone by.  IVsShell, IVsShell2, 3, 4...  Each one inherits from the previous.  
     * MEF was built to span versions of visual studio.  Features werw added that belonged in the interface, but a tennet of programming is that the interface never changes.  
     * VsShell3/4 won't be in 2008, but are in 2010.  So you want to take advantage of functionality but can't in VS 2008
     *  
     * Well shit, what to do?  Same thing they did with COM.  Point it somewhere else.  Use the generic SFunctionPointManagerService which has *nothing* so we know it will not change
     * then the use is able to cast to whatever type is available.  It's always guaranteed to be at least the first interface.  
     *
     * 
     */
    [Guid("ED8C2E10-7646-4329-87B2-F3D4CDCB4383")]
    public interface SFunctionPointManagerService
    {
    }

}
